<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt"  prefix="fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<script type="text/javascript">
function addUser(){
		document.userForm.action="${pageContext.request.contextPath }/addUser.action";
		document.userForm.submit();
}
function editItemsQuery(){
		var bln = document.getElementsByName("user_id");
		for ( var i = 0; i < bln.length; i++) {
			if(bln[i].checked==true){
			document.userForm.action="${pageContext.request.contextPath }/items/editItemsQuery.action";
			document.userForm.submit();
				return;}
		}
		alert("请选择操作的用户！");
}
function deleteUser(){
		var bln = document.getElementsByName("user_id");
		for ( var i = 0; i < bln.length; i++) {
			if(bln[i].checked==true){
				document.userForm.action="${pageContext.request.contextPath }/deleteUser.action";
			document.userForm.submit();
				return;}
		}
		alert("请选择操作的用户！");
}
</script>
</head>
<body>
<form name="userForm"  action="${pageContext.request.contextPath }/addUser.action" method="post"
enctype="multipart/form-data">
<table>
	<tr>
		<td>选择</td> <td>用户账号</td> <td>用户密码 </td>
	</tr>
	<c:forEach items="${userList}" var="user">
		<tr>
			<td><input type="checkbox" name="user_id" value="${user.id}"></td> <td>${user.name}</td> <td>${user.password}</td>
		</tr>
	</c:forEach>
	<tr id="addUser">
		<td></td>
		<td><input type="text" name="name"/></td>
		 <td><input type="text" name="password"/></td>
	</tr>
	<tr>
		<td><input type="button" value="新增" onclick="addUser()"/></td>
		<td><input type="button" value="删除"  onclick="deleteUser()"/></td>
	</tr>
</table>
</form>
</body>
</html>